/**
 * @(#)ChannelApkInfoImpl.java 2016年9月22日
 * Copyright(C) 2015 ZHEXIN IT CO.,LTD. All rights reserved.
 */
package org.jsbd.boss.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.jsbd.boss.dao.IChannelProvicneInfoDAO;
import org.jsbd.boss.domian.ChannelProvinceInfo;
import org.jsbd.boss.domian.channel.ApkPRIConfig;
import org.jsbd.boss.domian.channel.ApkProvinceVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import edu.hziee.common.dbroute.BaseDAO;

/**
 * TODO 请加入本类的说明
 * 
 * @author <a href="mailto:zhangbinghua@zhexinit.com" >zbh</a>
 * @version 1.0.0
 */
public class ChannelProvinceInfoDAOImpl extends BaseDAO implements IChannelProvicneInfoDAO {
	public static final Logger LOGGER = LoggerFactory.getLogger(ChannelProvinceInfoDAOImpl.class);


	@Override
	public Map<String, Object> selectConfigPageListMap(ChannelProvinceInfo form) {
		form = (form == null ? new ChannelProvinceInfo() : form);
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("total", super.queryForCount("qy_channelprovince_config.select_config_page_list_count", form));
		map.put("rows", super.queryForList("qy_channelprovince_config.select_config_page_list", form));

		return map;
	}

	@Override
	public Integer insertConfig(ChannelProvinceInfo form) {
		return super.update("qy_channelprovince_config.INSERT_CONFIG", form);
	}

	@Override
	public List<ChannelProvinceInfo> getConfigByMark(String mark) {
		Map<String, String> params = new HashMap<String, String>();
		params.put("mark", mark);
		return super.queryForList("qy_channelprovince_config.GET_CONFIG_BY_MARK", params);
	}

	@Override
	public Integer deleteConfig(String mark) {
		return super.delete("qy_channelprovince_config.DELETE_CONFIG", mark);
	}

	@Override
	public Integer updateMark(ChannelProvinceInfo channelProvinceInfo) {
		return super.update("qy_channelprovince_config.UPDATE_MARK", channelProvinceInfo);
	}

	@Override
	public Integer updateProvinceByMark(ChannelProvinceInfo channelProvinceInfo) {
		return super.update("qy_channelprovince_config.UPDATE_PROVINCE_CHANNELAPK_BYMARK", channelProvinceInfo);
	}

	@Override
	public Integer deleteProvinceByMarkAndId(String mark, String provinceid) {
		Map<String, String> params = new HashMap<String, String>();
		params.put("mark", mark);
		params.put("provinceid", provinceid);
		return super.delete("qy_channelprovince_config.DELETE_CONFIG_BY_MARKPROVINCEID", params);
	}

	@Override
	public List<ChannelProvinceInfo> getProvinceByProvinceId(String provinceid) {
		return super.queryForList("qy_channelprovince_config.GET_PROVINCECONFIG_BY_PROVINCEID", provinceid);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * org.jsbd.boss.dao.IChannelProvicneInfoDAO#getProvinceByProvinceId(int)
	 */
	@Override
	public List<ApkPRIConfig> getApkPRIConfigByProvinceId(int provinceid) {
		return super.queryForList("qy_channelprovince_config.SELECT_APK_PROVINCE_CONFIG", provinceid);
	}

	@Override
	public Integer deleteApkProvinceConfigs(ApkProvinceVo vo) {
		return super.delete("qy_channelprovince_config.DELETE_CONFIGS", vo);
	}

}
